Skip to content

Conversation

@alessio-perugini
Copy link
Contributor

Introduce a cache clean <app-id> command to clean app cache. This implementation also tries to stop the related app if running. In case we do not care about that we can simply rm -rf .cache/*.

Super simple implementation. The stopping of an app could be opionionated, eager to see what you think. In case it's too much we can remove that logic and/or trigger it with a specific flag.

Closes #52

Introduce a `cache clean <app-id>` command to clean app cache.
This implementation also tries to stop the related app if running. In
case we do not care about that we can simply rm -rf `.cache/*`.

Closes arduino#52
@lucarin91
Copy link
Contributor

The stopping of an app could be opionionated, eager to see what you think. In case it's too much we can remove that logic and/or trigger it with a specific flag.

I think stopping the running app makes sense; otherwise, we could lose the ability to do that afterward. A potential alternative could be to refuse to remove the cache of a running app.
Maybe we should add a flag

  • cache clean <app-id> fails if the app is running
  • cache clean <app-id> --force stops the app and then deletes the cache

@lucarin91
Copy link
Contributor

I also not sure if the command should be in the app sub-command, for instance

arduino-app-cli app clean-cache <app-id> [--force]

@mirkoCrobu
Copy link
Contributor

I agree with @lucarin91 about the usage of the flag.
About the location can be under "app" or maybe under "system"?
arduino-app-cli system clean-cache <app-id>

@dido18
Copy link
Contributor

dido18 commented Nov 11, 2025

I vote for the clean-cache under the app command.

arduino-app-cli app clean-cache <app-id>
``

@alessio-perugini
Copy link
Contributor Author

alessio-perugini commented Nov 11, 2025

While implementing the CLI subcommands I took inspiration from the arduino-cli. My idea was to have similar mapping to what our user based is used to.

However I also feel like that the cache/clean-cache could be implemented as a subcommand of the app. Probably would be easier to understand it's scope, can be a bit surprising to have a generic cache that, for now, only operates on app related stuff.

cache clean --force stops the app and then deletes the cache

@lucarin91 yeah I like that

Add `--force` flag to forcefully terminate the app in case it's running,
and then clean the related cache.
@alessio-perugini
Copy link
Contributor Author

alessio-perugini commented Nov 11, 2025

I'll wait for you guys design decision about the CLI api, in the meantime I've pushed the proposal to introduce the --force flag.

As soon as you reach an agreement shoot me a comment and I'll apply the proposed changes, if any. 🤓

@per1234 per1234 added the enhancement New feature or request label Nov 12, 2025
@mirkoCrobu
Copy link
Contributor

@alessio-perugini Thinking about it again, arduino-app-cli app clean-cache <app-id> [--force] I agree with @lucarin91
The clean-cache is at the app level. System is too general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add cache cleanup command

5 participants